package cn.stylefeng.guns.sys.modular.plotHouseInfo.service;

import cn.stylefeng.guns.sys.modular.plotHouseInfo.model.TreeBean;

import java.util.ArrayList;
import java.util.List;

public class UnitTree {

    private String id;
    private String label;
    List<LevelTree> children = new ArrayList();

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public List<LevelTree> getChildren() {
        return children;
    }

    public void setChildren(List<LevelTree> children) {
        this.children = children;
    }

    public UnitTree(String id, String label) {
        super();
        this.id = id;
        this.label = label;
    }

    public void addLevel(TreeBean bean) {
        if (children.stream().filter(i -> bean.getLevel_no().equals(i.getLabel())).count() == 0) {
            this.children.add(new LevelTree(plotTree.treeId++ + "", bean.getLevel_no()));
        }
    }

}
